package com.example.config.bean;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.Date;

@Data
@Component
@PropertySource(value = "classpath:persion.properties" , encoding = "utf-8")
public class Person1 {

    // @Value("${}")  用户获取属性值
    @Value("${person.last-name}")
    private String lastName;
    // @Value("#{}")  sqel表达式,可以读取bean的属性和调用方法
    @Value("#{11*2}")
    private Integer age;
    @Value("true")
    private Boolean boss;

    private Date birth;

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

}
